package ee.ut.math.chess.game.model;

import ee.ut.math.chess.base.model.chesspiece.ChessPiece;
import ee.ut.math.chess.base.model.chesspiece.Color;

public class DummyPersistenceManager {
	private ChessPiece[][] original = new ChessPiece[8][8];
	private Game game;
	private Color col;
	
	public DummyPersistenceManager(Game game) {
		this.game = game;
		this.col = game.getWaitingForPlayer();
		for (int i=0; i < 8; i++) {
			for (int j = 0; j < 8; j++) {
				original[i][j] = game.getBoard().getChessPiece(i, j);
			}
		}
	}
	
	public void rollback() {
		game.getBoard().setBoard(original);
		if (game.getWaitingForPlayer() != col){
			game.nextTurn();
		}
	}
}
